import { Suspense } from "react"; import { notFound } from "next/navigation"; import { requireUser } from "@/lib/auth/session.ts"; import { all, get } from "@/lib/db/index.ts"; import { ChatApp } from "@/components/chat/chat-app"; export const metadata = { title: "Chat" }; export default async function ChatConversationPage(ctx: { params: Promise<{ id: string }> }) { const user = await requireUser(); const id = parseInt((await ctx.params).id, 10); const conv = get("SELECT id FROM conversations WHERE id = ? AND user_id = ?", id, user.id); if (!conv) notFound(); const courses = all<{ code: string; title: string; color: string }>( `SELECT c.code, c.title, c.color FROM courses c JOIN enrollments e ON e.course_code = c.code WHERE e.user_id = ? AND c.active = 1 ORDER BY c.code`, user.id ); return ( ); }